package com.itheima.tliasmanagementspringboot.controller;

import com.itheima.tliasmanagementspringboot.common.R;
import com.itheima.tliasmanagementspringboot.mapper.EmpMapper;
import com.itheima.tliasmanagementspringboot.pojo.Student;
import com.itheima.tliasmanagementspringboot.service.EmpService;
import com.itheima.tliasmanagementspringboot.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {
    @Autowired
    EmpService empService;
    @Autowired
    StudentService studentService;

    //员工性别人数统计
    @GetMapping("/empGenderData")
    R queryCountGroupByGender(){
        return R.ok(empService.queryCountGroupByGenderService());
    }

    //员工职位人数统计
    @GetMapping("/empJobData")
    R queryCountGroupByJob(){
        return R.ok(empService.queryCountGroupByJobService());
    }

    //根据班级学员人数统计
    @GetMapping("/studentData")
    R queryCountGroupByClazz(){
        return R.ok(studentService.queryCountGroupByClazzService());
    }
}
